Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modified the movefocus dispatcher to prioritize focus change within groups. #8601

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

normaltaro
Copy link
Contributor

@normaltaro normaltaro commented Nov 28, 2024

Describe your PR, what does it fix/add?

It modifies the movefocus dispatcher logic to switch directional focus within groups first:

  • Check if the current window is part of a Group.
  • movefocus l/r can now be used to switch tabs within the Group
  • If the current window is the first/last tab of its group OR movefocus u/d is pressed, then the usual directional focus logic applies.

In other words, a sideways directional focus change is prioritized within groups first.

How I think it benefits users?
  • Better defaults
    • I think most users (like me) expect the directional flow of movefocus dispatcher to be followed within groups as it does in other window managers. I felt locked out of tabbed groups and never really used them because of this.
    • It is not possible to do so using changegroupactive along with movefocus as they require separate keybinds which do not conflict.
    • This keeps the last active index intact when focus is moved out of the group.
    • Personally, I think the overall experience with this patch is much better compared to other window managers regarding tabbed groups (like i3)
  • Example:
    • mod h/j/k/l with movefocus l/r/u/d is intuitive for groups too.

Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)

I haven't found any bugs. It works as per the logic described above.

Is it ready for merging, or does it need work?

I have tried with all kinds of group orientations and it works good. It is a single block of 13 lines and could be merged as-is. :)

@vaxerski
Copy link
Member

hyprctl dispatch changegroupactive f | grep "next" && hyprctl dispatch movefocus r?

@normaltaro
Copy link
Contributor Author

normaltaro commented Nov 29, 2024

hyprctl dispatch changegroupactive f | grep "next" && hyprctl dispatch movefocus r?

This doesn't seem to work. once the focus gets into a grouped window tab, it doesn't reach out to other windows/groups at all. It keeps cycling between tabs of the same group.

2024-11-29.17-30-02.mp4

It should jump into other windows at the end of the tabs like this:

out.mp4

This video demonstrates this patch. My bindings in this video are:

bind = $mainMod, h, movefocus, l
bind = $mainMod, l, movefocus, r
bind = $mainMod, k, movefocus, u
bind = $mainMod, j, movefocus, d

I built and ran the main branch and my branch separately to demonstrate

@vaxerski
Copy link
Member

vaxerski commented Dec 2, 2024

should be an option, some people might not like this

@normaltaro
Copy link
Contributor Author

normaltaro commented Dec 2, 2024

how about another dispatcher, like movefocusingroups? or should i add parameter(s) to movefocus?

@normaltaro normaltaro marked this pull request as draft December 2, 2024 18:22
@vaxerski
Copy link
Member

vaxerski commented Dec 4, 2024

I was thinking about simply a bool flag in binds:

@normaltaro
Copy link
Contributor Author

normaltaro commented Dec 11, 2024

added bool option variable movefocus_cycles_groupfirst to binds.

sorry for delay.

PR for docs: hyprwm/hyprland-wiki#900

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants